package response

type Response[T any] struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data T      `json:"data"`
}

func Success[T any](data T) *Response[T] {
	return &Response[T]{Data: data, Code: 200}
}
func Fail[T any](msg string) *Response[T] {
	return &Response[T]{Msg: msg, Code: 500}
}
func SuccessWithMsg[T any](msg string) *Response[T] {
	return &Response[T]{Msg: msg, Code: 200}
}
